package top.coolrainly.module.pb.controller.app.theme;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.coolrainly.framework.common.pojo.CommonResult;
import top.coolrainly.module.pb.controller.admin.theme.vo.ThemeRespVO;
import top.coolrainly.module.pb.convert.theme.ThemeConvert;
import top.coolrainly.module.pb.service.theme.ThemeService;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.util.List;

import static top.coolrainly.framework.common.pojo.CommonResult.success;

@Tag(name = "用户 App - 党建 主题")
@RestController
@RequestMapping("/pb/theme")
@Validated
public class AppThemeController {

    @Resource
    private ThemeService themeService;

    @GetMapping("/list")
    @Operation(summary = "获得所有主题")
    public CommonResult<List<ThemeRespVO>> List() {
        return success(ThemeConvert.INSTANCE.convertList01(themeService.getThemeList()));
    }
}
